//package jp.sourceforge.talisman.mds.distance;
//
///*
// * $Id: MinkowskyItemDistanceCalculatorTest.java,v 1.1 2009/09/12 05:06:08 weiwei Exp $
// */
//
//import org.junit.Assert;
//import org.junit.Before;
//import org.junit.Test;
//
///**
// * 
// * @author Haruaki Tamada
// * @version $Revision: 1.1 $ 
// */
//public class MinkowskyItemDistanceCalculatorTest{
//    private MinkowskyItemDistanceCalculator calculator;
//
//    @Before
//    public void setUp(){
//        calculator = new MinkowskyItemDistanceCalculator();
//    }
//
//    @Test
//    public void testCityBlockDistance(){
//        Assert.assertEquals(ItemDistanceAlgorithm.MINKOWSKY_DISTANCE, calculator.getAlgorithm());
//
//        calculator.setPValue(1);
//        Assert.assertEquals(7d, calculator.calculate(new double[] { 4, 3, }, new double[] { 0, 0, }), 1E-6);
//        Assert.assertEquals(2d, calculator.calculate(new double[] { 1, 1, }, new double[] { 0, 0, }), 1E-6);
//        Assert.assertEquals(5d, calculator.calculate(new double[] { 1, 5, }, new double[] { 3, 2, }), 1E-6);
//    }
//
//    @Test
//    public void testEuclideanDistance(){
//        calculator.setPValue(2);
//        Assert.assertEquals(5d, calculator.calculate(new double[] { 4, 3, }, new double[] { 0, 0, }), 1E-6);
//        Assert.assertEquals(Math.sqrt(2), calculator.calculate(new double[] { 1, 1, }, new double[] { 0, 0, }), 1E-6);
//        Assert.assertEquals(2d, calculator.calculate(new double[] { 1, Math.sqrt(3), }, new double[] { 0, 0, }), 1E-6);
//    }
//
//    @Test
//    public void testThree(){
//        calculator.setPValue(3);
//        Assert.assertEquals(
//            Math.pow(4d * 4d* 4d + 3d * 3d * 3d, 1 / 3d),
//            calculator.calculate(new double[] { 4, 3, }, new double[] { 0, 0, }),
//            1E-6
//        );
//
//        Assert.assertEquals(
//            Math.pow(2d, 1 / 3d),
//            calculator.calculate(new double[] { 1, 1, }, new double[] { 0, 0, }), 1E-6
//        );
//
//        Assert.assertEquals(
//            Math.pow(1 + 3 * Math.sqrt(3), 1 / 3d),
//            calculator.calculate(new double[] { 1, Math.sqrt(3), }, new double[] { 0, 0, }),
//            1E-6
//        );
//    }
//}
